﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using DynSim.EntityFramework;
using DynSim.Basics;

namespace DynSim.Entities
{
    [Serializable]
    public class BasicText : IEntity, IMoveable, IHideable
    {
        public string name { get; set; }

        SpriteBatch batch;
        SpriteFont font;
        public string text;
        public Color color;
        Vector3 position;
        float scale = 1f;
        bool show = true;

        public BasicText(string assetName, Vector3 position, BaseEngine engine, Game game, string text, Color color, string name)
        {
            this.name = name;

            this.batch = new SpriteBatch(game.GraphicsDevice);
            this.font = game.Content.Load<SpriteFont>(assetName);
            this.position = position;
            this.text = text;
            this.color = color;
        }

        public void Initialize()
        {
            
        }

        public void Update(GameTime gameTime)
        {
            
        }

        public void Draw(GameTime gameTime)
        {
            if (show)
            {
                batch.Begin();
                batch.DrawString(font, text, new Vector2(position.X, position.Y), color);
                batch.End();
            }
        }

        public void Move(Vector3 position)
        {
            this.position = position;
        }

        public void Scale(float value)
        {
            this.scale = value;
        }

        public void Show()
        {
            this.show = true;
        }

        public void Hide()
        {
            this.show = false;
        }
    }
}
